
var leftcontent;
var rightcontent;

var startup;

var startUpThingsToDo = [];
var resizeThingsToDo = [];

// set this variable to make app full width.
var fullwidthpleasedamnyou;

function laosinit1() {
    try {

        leftcontent = document.getElementById("divleft").innerHTML;
        //rightcontent = document.getElementById("divright").innerHTML;

        laosinitInner1();

        var myMenu;
        myMenu = new SDMenu("my_menu");
        myMenu.init();

        if (startup != undefined) {
            startup();
        }

        for (fn in startUpThingsToDo) {
            startUpThingsToDo[fn]();
        }

        $(window).resize(function () {

            laosinitInner1();

            if (!laostmdDetectMobile()) {
                var myMenu;
                myMenu = new SDMenu("my_menu");
                myMenu.init();
            }

            if (startup != undefined) {
                startup();
            }

            for (fn in resizeThingsToDo) {
                resizeThingsToDo[fn]();
            }
        });
    }
    catch (e) {
        alert(e);
    }
}

function laosGetStats() {
    var buffer = 'Screen is: ' + screen.width + ' pixels by ' + screen.height;
    buffer += '\n';
    buffer += "    jQuery " + $(window).width() + " pixels by " + $(window).height();
    buffer += '\n';
    if (laostmdDetectMobile())
        buffer += '-------a mobile!';
    else
        buffer += '-------not a mobile!';

    buffer += '\n\n';
    buffer += navigator.userAgent;
    buffer += '\n\n';
    return buffer;
}

function laosReportStats() {
    var buffer = laosGetStats();

    if (laostmdDetectFireFox()) {
        document.getElementById("time").innerHTML = buffer;
    }
    else {
        document.getElementById("time").innerText = buffer;
    }
}

function fnIsLinear() {
    return $(window).width() <= 800 || laostmdDetectMobile();
}

function laosinitInner1() {

    var activeWidth = $(window).width();
    var isLinear = fnIsLinear();

    var mycontent = activeWidth - 290; 
  
    var middlewidth = isLinear ? activeWidth : mycontent;
        
    document.getElementById("div1").style.width = activeWidth;
    document.getElementById("divparent").style.left = "0px";
    document.getElementById("divparent").style.width = "" + activeWidth + "px";
    document.getElementById("divmid").style.width = "" + middlewidth + "px";

    document.getElementById("divInnerBanner").style.width = "" + activeWidth - 120 + "px"; // room for google ad

    if (isLinear) // format linear
    {
        document.getElementById("divfooter1").innerHTML = leftcontent;
        document.getElementById("divleft").innerHTML = "";
    }
    else 
    {
        document.getElementById("divfooter1").innerHTML = "";
        document.getElementById("divleft").innerHTML = leftcontent;   
    }
    
    document.getElementById("divleft").style.width = "290px";

    // "Bleeding" problem with hotels. Fix here is good for all pages.
    document.getElementById("divmid").style.overflow = "hidden";
}
